﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="YxsbDetail.aspx.cs" Inherits="Rison.Web.ZP.YxsbDetail" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<%@ Register src="~/ascx/WebHeader.ascx" tagname="WebHeader" tagprefix="uc1" %>
<%@ Register src="~/ascx/WebFooter.ascx" tagname="WebFooter" tagprefix="uc1" %>
<%@ Register src="~/ascx/SiteMapPath.ascx" tagname="SiteMapPath" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>网站特色项目申报表</title>
    <link href="../style/css/style.css" rel="stylesheet" type="text/css" enableviewstate="false" />
    <link rel="stylesheet" href="../script/jqueryui/css/custom-theme/jquery-ui-1.8.14.custom.css" type="text/css" media="all" /> 
    <script type="text/javascript" src="../script/jqueryui/js/jquery-1.5.1.min.js"></script>
    <script type="text/javascript" src="../script/jqueryui/js/jquery-ui-1.8.14.custom.min.js"></script>
    <script type="text/javascript" src="../ZJCP/js/TopNews.js"></script>   
    <script type="text/javascript" src="../script/core.js"></script>   
    <script type="text/javascript" src="js/yxsb_detail.js"></script>
    <link href="../CommonPage/FileUploader/upload.css" rel="stylesheet" type="text/css" />
    <script src="../script/jquery.ajaxfileupload.js" type="text/javascript"></script>
    <script type="text/javascript" src="../ZJCP/ashx/judge_expert_user.ashx"></script>    
    <script type="text/javascript">
/*fileuploader*/

      var indexF = 0;
 	//fileupload1_lblF_,fileupload1_rmlink,fileupload1_mdiv,fileupload1_hdnFileVal
 	function addlabel(v,fieldname) {
 		var m = $('<div class="iptdiv" id="' + fieldname + '_lblF_' + indexF++ + '"><img src="../CommonPage/FileUploader/images/loading.gif" class="imgload" /><span>' + v + '</span>&nbsp;&nbsp;&nbsp;&nbsp;<a  name="'+ fieldname + '_rmlink">删除</a>' +
			'<input type="hidden" name="'+ fieldname + '_hdnFileVal"/></div>')			
			.appendTo("#"+ fieldname +"_mdiv");

		//删除按钮<img src="../CommonPage/FileUploader/images/loading.gif" />
		m.find("a[name=" + fieldname + "_rmlink]").click(function () {
 			var _this = $(this);
 			$(_this.attr("ref")).remove(); //删除file input
 			_this.parent().remove();


 			var hdnobj = _this.parent().find("input:hidden");
 			//删除服务器临时文件
 			var u = "../CommonPage/FileUploader/AjaxHandler.ashx?random=" + Math.random();
 			var v = { action: "delf", path: hdnobj.val() };

 			$.ajax({
 				type: "POST",
 				url: u,
 				data: v,
 				dataType: "json",
 				success: function (re) {
 					//for test, eventually it should do nothing here;
 					//alert(re.msg);

 				},
 				error: function (r, e, re) {
 					//do nothing;
 					alert(e);
 					alert(re.msg);
 				}
 			});

 		});
 	

 		return m[0];
 	}


	//选择文件后
 	function fileChange(e,fileid) {

		//TODO: 过滤文件类型

 		//添加Label控件
 		var showtxt = e.value.substring(e.value.lastIndexOf("\\") + 1);
 		var lblobj = addlabel(showtxt,fileid);
 		
		window.setTimeout("doUpload('" + lblobj.id + "','" + fileid + "')",0); 

 	}



	//异步上传
 	function doUpload(lblobjID,fileid) {
 		
 		var fileobj = $("#" + fileid);
 		var op = $("#" + lblobjID);

 		//TODO:		验证导入文件

 		var loadingobj = op.find("img");
 		var hdnobj = op.find("input:hidden");

		//上传
 		var uploadre = $.ajaxFileUpload(
		{
			url: '../CommonPage/FileUploader/AjaxHandler.ashx?action=uploadf&random=' + Math.random(),
			secureuri: false,
			fileElementId: fileobj[0].id,
			dataType: 'json',
			success: function (data, status) {
				if (data.status == 'success') {

					hdnobj.val(data.msg);
					

					loadingobj.attr("src", "../CommonPage/FileUploader/images/ok.png");
				}
				else {
					// unloading();
					alert(data.msg);
					loadingobj.attr("src", "../CommonPage/FileUploader/images/cancel.png");
				}
			},
			error: function (data, status, e) {
				//unloading();
				alert(status + ": "+ e.message);
				loadingobj.attr("src", "../CommonPage/FileUploader/images/cancel.png");
			}
		});


 		if (uploadre == false) {
 			loadingobj.hide();
 			loadingobj.attr("src", "../CommonPage/FileUploader/images/cancel.png");

 		}
 	}  
 	
 	function removeAtts(_v,_o){

 	   var _ov=$("#"+_o).val();
 	   if($.trim(_ov)==''){
 	    $("#"+_o).val(_v);
 	   }else{
 	    $("#"+_o).val(_ov+","+_v);
 	   }
 	    $("#"+_v).parent().html("");
 	}        
    </script>
</head>
<body>
    <form id="form1" runat="server">
      <%--头部--%>
    <uc1:WebHeader ID="WebHeader1" runat="server" />
    <div id="main">
       <div id="container">
       <div class="place">
               <table width="100%" border="0" cellspacing="0" cellpadding="0">             
                 <tr>
                   <td><uc1:SiteMapPath ID="SiteMapPath1" runat="server" /></td>               
                 </tr>
               </table>
        </div>
        <div class="paodai"><table cellpaddin="0" border="0" cellspacing="0" width="100%">
                <tr>
                    <td width="50%"><asp:Label ID="LabTBRQ" runat="server" Text=""></asp:Label></td>
                    <td align="right" width="50%"><span style="display:none;float:right"></span></td>
                </tr>
            </table></div>
        <div  class="huibg">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tab" >
            <tr>
                <td class="top2">
                  <span class="title2">标题：</span><asp:TextBox class="Text" ID="TextBox1" runat="server" Width="820px"></asp:TextBox>
                </td>
            </tr>
            <tr >
               <td class="top3"><span class="title2">案例类型：</span><asp:Label ID="Labanlx" runat="server"></asp:Label>
               </td>
            </tr>

              <tr>
               <td class="top3"><span class="title2">正文：</span>（3000字以内）</td>
            </tr>
            <tr>
            
            <td>
                <FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server" BasePath="../fckeditor/" 
                    Height="500px">
                </FCKeditorV2:FCKeditor>
            </td>
            </tr>
            <tr><td height="20"></td></tr>
            <tr><td><table>
                        <tr>
                            <td>
                                <a href="javascript:void(1==1);" class="addfile" style="cursor: default;" hidefocus="true" id="A8">
                                    <input id='fileUploader9' class='filestyle' type='file' size='1' onchange="fileChange(this,'fileUploader9');" title='点击选择附件' hidefocus="true" name="fileUploader8"/>
                                </a>
                            </td>
                        </tr>
                            <tr>
	                            <td>
		                            <div id="fileUploader9_mdiv"></div>
	                            </td>
                            </tr>
                            <tr><td><input type="hidden" id="fileUploader9_del"  name="fileUploader9_del"/>
                                <asp:DataList ID="DataList9" runat="server" RepeatColumns="1" RepeatDirection="Horizontal" Width="100%">
                                    <ItemTemplate>
                                        <a  href="<%=UploadPath%><%# DataBinder.Eval(Container.DataItem, "PhysicalName")%>" target="_blank"><%# DataBinder.Eval(Container.DataItem, "DisplayName")%></a>
                                        <a href="javascript:removeAtts('<%# DataBinder.Eval(Container.DataItem, "ID")%>','fileUploader9_del')" id="<%# DataBinder.Eval(Container.DataItem, "ID")%>">删除</a>
                                    </ItemTemplate>
                                </asp:DataList></td></tr>
                        </table></td></tr>
            </table>
        </div>
        <div class="tijiao">                
            <asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="提    交" CssClass="button"/>
            <asp:Button ID="Button1" runat="server" onclick="btnBack_Click" Text="返    回" CssClass="button"/>
        </div>
    
     <%--尾部--%>
    <uc1:WebFooter ID="WebFooter" runat="server" /> 
    </form>
</body>
</html>
